<template>
  <div class="latestUpdate-body">
    <backTo-view :child-msg="current"></backTo-view>
    <div class="content">
      <ul class="cf">
        <introduceList-view :child-msg="item" v-for="item in dataList" :key="item.id"></introduceList-view>
        <!--<li class="cf">
          <div class="fl ">
            <img src="/static/img/hyxd.png" alt="" class="fl" />
            <div class="fl ">
              <p class="font28">游戏虫APP下载</p>
              <p>134.6M<span class="green"> 2018-04-23 </span></p>
              <p>（一句话描述）全新地图 高清新版</p>
            </div>
          </div>
          <div class="fr downDtn ">
            下载
          </div>
        </li>-->
      </ul>
    </div>
  </div>
</template>

<script>
import introduceList from '../components/introduceList.vue'
import backTo from '../components/backTo.vue'
export default {
  name: 'latestUpdate',
  components: {
    'introduceList-view': introduceList,
    'backTo-view': backTo
  },
  data () {
    return {
      type: false,
      current: '最近更新',
      dataList: [],
      classify: {
        type: '游戏分类',
        data: [
          {
            name: '全部',
            has: true
          },
          {
            name: '角色扮演',
            has: false
          },
          {
            name: '动作',
            has: false
          },
          {
            name: '策略',
            has: false
          },
          {
            name: '卡牌',
            has: false
          },
          {
            name: '模拟',
            has: false
          },
          {
            name: '益智',
            has: false
          },
          {
            name: '休闲',
            has: false
          },
          {
            name: '街机',
            has: false
          },
          {
            name: '冒险',
            has: false
          },
          {
            name: '体育',
            has: false
          }
        ]
      }
    }
  },
  created () {
    let searchAPI = '/game/nearByUpdate/1'
    let that = this
    this.searchWord = this.$route.query.text
    // 此地有传auth(token)认证 为空就不会执行
    this.$request.post(searchAPI, {'keyWord': this.searchWord}, true,
      function (res) {
        if (res.data.code === 1000) {
          that.dataList = res.data.rst
        }
      }
    )
  },
  methods: {
    toDetail (id) {
      this.$router.push({path: '/detail', query: {userId: id}})
    }
  },
  beforeRouteEnter (to, from, next) {
    next(vm => {
      // 通过 `vm` 访问组件实例
      // console.log(vm)
    })
    // 在渲染该组件的对应路由被 confirm 前调用
    // 不！能！获取组件实例 `this`
    // 因为当守卫执行前，组件实例还没被创建
  }
}
</script>
<style scoped>
.left-header .title{
  height: 30px;
  line-height: 30px;
  width: 100%;
  padding: 0 0 15px 0;
}
.left-header div{
  float: left;
  color: rgba(115, 115, 115, 1);
  font-size: 20px;
  text-align: left;
  font-family: Roboto;
}
.left-header span{
  cursor: pointer;
  float: right;
  color: rgba(115, 115, 115, 1);
  font-size: 14px;
  text-align: right;
  font-family: Roboto;
  padding: 0 5px;
}
.leftList{
  clear: both;
}
.bjBlue{
  color: #009688 !important;
}
</style>
